<?php
/**
 * Created by PhpStorm.
 * User: liu
 * Date: 2018/9/11
 * Time: 23:32
 */

namespace app\blog\controller;


use think\Controller;

class Category extends Controller
{
    public function index(){
        $id=input('id',0,'intval');
        $rows=\app\admin\model\blog\Post::where(['category_id'=>$id,'status'=>0])
            ->withCount('comments')
            ->order(['created'=>'desc'])
            ->paginate(10,false,[
                'query'=>['id'=>$id]
            ]);
        return $this->fetch('',['rows'=>$rows]);
    }
}